/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package publisher;

/**
 *
 * @author jfernan
 */

// from  http://www.jmock.org/getting-started.html

// http://atunit.googlecode.com/svn/trunk/doc/api/atunit/example/ExampleEasyMockTest.java.xhtml



import atunit.AtUnit;
import atunit.Mock;
import atunit.MockFramework;
import atunit.Unit;
import static org.easymock.EasyMock.*;
import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;


@RunWith(AtUnit.class)
@MockFramework(MockFramework.Option.EASYMOCK) // use JMock for mock objects
public class PublisherTest_atunit_easymock {



     @Unit IPublisher publisher;
     @Mock Subscriber subscriber;

     
    @Before
    public void setUp() {
        publisher = new Publisher();

    }

    @Test
    public void oneSubscriberReceivesAMessage() {

        String message="message";

        //expect(
          subscriber.receive(message);

        //		expect(this.mock.getListOfPendingCustomers()).andReturn(listCustomers);

        replay(subscriber);
        
        publisher.add(subscriber);
        publisher.publish(message);
        
        verify(subscriber );
              
    

    }


}
